class TarefasController < ApplicationController
   load_and_authorize_resource

  def index
    @tarefas = Tarefa.all
  end

  def new
    @tarefa = Tarefa.new
  end

  def create
    @tarefa = Tarefa.new(params[:tarefa])
    if @tarefa.save
      flash[:notice] = "tarefa cadastrada com sucesso"
      redirect_to @tarefa
    else
      flash[:error] = "Tarefa nao salva"
      render :new
    end
  end

  def menu_tarefa
    render 'tarefas/menu'
  end

  def show
    @tarefa = Tarefa.find(params[:id])
  end

end